package com.itgzs.back.mapper;

import com.itgzs.back.bean.Sensor;
import org.apache.ibatis.annotations.Update;

public interface SensorMapper {

    @Update(
        "<script>"
            + "UPDATE `sensor` "
                + "<set>"
                    + "<if test='light != null'>light = #{light}, </if>"
                    + "<if test='co2 != null'>co2 = #{co2}, </if>"
                    + "<if test='voc != null'>voc = #{voc}, </if>"
                    + "<if test='temp != null'>temp = #{temp}, </if>"
                    + "<if test='humidity != null'>humidity = #{humidity}, </if>"
                + "</set>"
            + "WHERE id = 1"
        + "</script>"
    )
    void updateSenser(Sensor sensor);
}
